package name.williamwall.buxoid;
/**
 * This software is made available under the Gnu General Public License v3
 * and has absolutely no waranty. You may change the software to suit your needs.
 * 
 * Author: William Wall, IV
 */
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class Help extends Activity {
	private TextView mText;
	private String mTopic;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		setContentView(R.layout.help);
		
		mText = (TextView) findViewById(R.id.help_text);
		
		mTopic = savedInstanceState != null ? savedInstanceState.getString("topic") : null;
		
        if (mTopic == null) {
        	Bundle extras = getIntent().getExtras();
        	mTopic = extras != null ? extras.getString("topic") : null;
        }
        
        Button videos = (Button) findViewById(R.id.button_videos);
        videos.setOnClickListener(new View.OnClickListener() {
            public void onClick(View view) {
                startActivity(new Intent(Help.this, HelpVideos.class));
            }
        });
        
        fillData(mTopic);
	}
	
	private void fillData(String topic) {
		if (topic.equals("Accounts")) {
			setTitle("Buxoid Help: Accounts");
			mText.setText(R.string.help_accounts);
		} else if (topic.equals("Expenses")) {
			setTitle("Buxoid Help: Expenses");
			mText.setText(R.string.help_analysis);
		} else if (topic.equals("Budgets")) {
			setTitle("Buxoid Help: Budgets");
			mText.setText(R.string.help_budgets);
		} else if (topic.equals("Transactions")) {
			setTitle("Buxoid Help: Transactions");
			mText.setText(R.string.help_transactions);
		} else if (topic.equals("Settings")) {
			setTitle("Buxoid Help: Settings");
			mText.setText(R.string.help_settings);
		} else if (topic.equals("Updating")) {
			setTitle("Buxoid Help: Buxfer Updates");
			mText.setText(R.string.help_updates);
		} else if (topic.equals("Impacts")) {
			setTitle("Buxoid Help: Impacts");
			mText.setText(R.string.help_impacts);
		}
	}

	@Override
	protected void onRestoreInstanceState(Bundle savedInstanceState) {
		super.onRestoreInstanceState(savedInstanceState);
		fillData(mTopic);
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putString("topic", mTopic);
	}
}
